<template>
	<view class="main">
		<u-navbar
			          title="页面不存在"
			          :autoBack="true"
			      >
			      </u-navbar>
		<view class="empty">
			<u-empty mode="data" iconSize="80" textSize="18" :icon="pic" :text="mytext"></u-empty>
			<view class="text" @click="goIndex">
				{{num}}秒后返回首页，<span style="color: #4581F6;">点击此处返回</span> 
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pic:require('@/static/icons/wuping.png'),
				mytext:'指定的页面不存在',
				num:10,
				timeOut:null
			};
		},
		methods:{
				goIndex(){
					clearInterval(this.timeOut)
					this.timeOut = null
					uni.reLaunch({
						url:'/pages/index/index'
					})
				},
				tick(){
					this.timeOut = setInterval(()=>{
						if(this.num > 0){
							--this.num
						} else{
							this.goIndex()
						}
					},1000)
				}
		},
		mounted() {
			// my.setNavigationBar({
			// 	title: '页面不存在'
			// })
			this.tick()
		},
		beforeDestroy() {
			clearInterval(this.timeOut)
		}
	}
</script>

<style lang="scss">
.main{
	background-color: #F5F6F8;
	height: 100vh;
	padding-top: 180rpx;
	.empty{
		padding-top: 40%;
		.text{
			color: #c0c4cc;
			margin-top: 30rpx;
			text-align: center;
			font-size: 36rpx;
		}
	}
	
}
</style>
